80 research outputs found

    Some Difficult-to-pass Tests of Randomness

    Get PDF
    We describe three tests of randomness-- tests that many random number generators fail. In particular, all congruential generators-- even those based on a prime modulus-- fail at least one of the tests, as do many simple generators, such as shift register and lagged Fibonacci. On the other hand, generators that pass the three tests seem to pass all the tests in the Diehard Battery of Tests. Note that these tests concern the randomness of a generator's output as a sequence of independent, uniform 32-bit integers. For uses where the output is converted to uniform variates in [0,1), potential flaws of the output as integers will seldom cause problems after the conversion. Most generators seem to be adequate for producing a set of uniform reals in [0,1), but several important applications, notably in cryptography and number theory-- for example, establishing probable primes, complexity of factoring algorithms, random partitions of large integers-- may require satisfactory performance on the kinds of tests we describe here.

    Evaluating Kolmogorov's Distribution

    Get PDF
    Kolmogorov's goodness-of-fit measure, D_n , for a sample CDF has consistently been set aside for methods such as the D^+_n or D^-_n of Smirnov, primarily, it seems, because of the difficulty of computing the distribution of D_n . As far as we know, no easy way to compute that distribution has ever been provided in the 70+ years since Kolmogorov's fundamental paper. We provide one here, a C procedure that provides Pr(D_n .999 with n's of several thousand, we provide a quick approximation that gives accuracy to the 7th digit for such cases.

    Fast Generation of Discrete Random Variables

    Get PDF
    We describe two methods and provide C programs for generating discrete random variables with functions that are simple and fast, averaging ten times as fast as published methods and more than five times as fast as the fastest of those. We provide general procedures for implementing the two methods, as well as specific procedures for three of the most important discrete distributions: Poisson, binomial and hypergeometric.

    The Monty Python Method for Generating Gamma Variables

    Get PDF
    The Monty Python Method for generating random variables takes a decreasing density, cuts it into three pieces, then, using area-preserving transformations, folds it into a rectangle of area 1. A random point (x, y) from that rectangle is used to provide a variate from the given density, most of the time as x itself or a linear function of x. The decreasing density is usually the right half of a symmetric density. The Monty Python method has provided short and fast generators for normal, t and von Mises densities, requiring, on the average, from 1.5 to 1.8 uniform variables. In this article, we apply the method to non-symmetric densities, particularly the important gamma densities. We lose some of the speed and simplicity of the symmetric densities, but still get a method for γα variates that is simple and fast enough to provide beta variates in the form γa(γa + γb). We use an average of less than 1.7 uniform variates to produce a gamma variate whenever α ≥ 1. Implementation is simpler and from three to five times as fast as a recent method reputed to be the best for changing α's.link_to_subscribed_fulltex

    The Ziggurat Method for Generating Random Variables

    Get PDF
    We provide a new version of our ziggurat method for generating a random variable from a given decreasing density. It is faster and simpler than the original, and will produce, for example, normal or exponential variates at the rate of 15 million per second with a C version on a 400MHz PC. It uses two tables, integers ki, and reals wi. Some 99% of the time, the required x is produced by: Generate a random 32-bit integer j and let i be the index formed from the rightmost 8 bits of j. If j < k, return x = j x wi. We illustrate with C code that provides for inline generation of both normal and exponential variables, with a short procedure for settting up the necessary tables

    The Ziggurat Method for Generating Random Variables

    Get PDF
    We provide a new version of our ziggurat method for generating a random variable from a given decreasing density. It is faster and simpler than the original, and will produce, for example, normal or exponential variates at the rate of 15 million per second with a C version on a 400MHz PC. It uses two tables, integers k_i, and reals w_i. Some 99% of the time, the required x is produced by: Generate a random 32-bit integer j and let i be the index formed from the rightmost 8 bits of j. If j

    Diagnostic accuracy of mediastinal width measurement on posteroanterior and anteroposterior chest radiographs in the depiction of acute nontraumatic thoracic aortic dissection

    Get PDF
    We aimed to explore the diagnostic accuracy of various mediastinal measurements in determining acute nontraumatic thoracic aortic dissection with respect to posteroanterior (PA) and anteroposterior (AP) chest radiographs, which had received little attention so far. We retrospectively reviewed 100 patients (50 PA and 50 AP chest radiographs) with confirmed acute thoracic aortic dissection and 120 patients (60 PA and 60 AP chest radiographs) with confirmed normal aorta. Those who had prior history of trauma or aortic disease were excluded. The maximal mediastinal width (MW) and maximal left mediastinal width (LMW) were measured by two independent radiologists and the mediastinal width ratio (MWR) was calculated. Statistical analysis was then performed with independent sample t test. PA projection was significantly more accurate than AP projection, achieving higher sensitivity and specificity. LMW and MW were the most powerful parameters on PA and AP chest radiographs, respectively. The optimal cutoff levels were LMW = 4.95 cm (sensitivity, 90 %; specificity, 90 %) and MW = 7.45 cm (sensitivity, 90 %; specificity, 88.3 %) for PA projection and LMW = 5.45 cm (sensitivity, 76 %; specificity, 65 %) and MW = 8.65 cm (sensitivity, 72 %; specificity, 80 %) for AP projection. MWR was found less useful and less reliable. The use of LMW alone in PA film would allow more accurate prediction of aortic dissection. PA chest radiograph has a higher diagnostic accuracy when compared with AP chest radiograph, with negative PA chest radiograph showing less probability for aortic dissection. Lower threshold for proceeding to computed tomography aortogram is recommended however, especially in the elderly and patients with widened mediastinum on AP chest radiograph

    Efficient parallel algorithms for some subsequence problems

    Get PDF
    published_or_final_versio

    人神婚中的齟齬與羈絆 : 論〈后土夫人〉及〈青蛙神〉中的人神關係及其社會文化意義

    Full text link
    每個民族及國家都有自己的神話,所謂神話是原人想像的產物,是源於他們對外在世界、自然環境的不理解,初民往往運用自己的想像來解釋自然現象,因為恐懼而創出神祇,各式各樣的崇拜、祭禮應運而生。 由於神話與人類的思想及社會發展有密切的關係, 而「神話不單是原人思想的結晶亦為原人生活的反映」 ,因此,神話發展到後代就少了原始崇拜的色彩,轉而有「神話生活化」的傾向,正如本文比較的兩篇小說,唐代的《異聞集‧后土夫人》(又名〈韋安道〉)與清代的《聊齋誌異‧青蛙神》,兩者同樣以上古傳統崇拜為原綱,具有神話色彩,後人保留神話的元素,再作有意的修改和增飾,使神話以小說形式流傳,原始時代的崇拜意味減少,加入的是當世社會發展、道德倫理規範的情節。另外,兩文同寫人神戀,后土夫人與蛙神之女十娘同樣是神女下嫁凡夫,小說背後所揭示的是人神婚中的不協調,兩神與凡人丈夫及人世間的家庭產生矛盾,即以不同的形象性格面對,發展出不同的結果,而發展的過程中出現「神女人格化」,表明小說的主旨不再是原始崇拜,而是著重於人神婚戀所衍生出的問題,因此本文將從神女的神威、性格形象、人神關係入手,以了解文本背後所反映的社會文化意義

    An optimal EREW parallel algorithm for parenthesis matching

    Get PDF
    published_or_final_versio
    corecore